package com.smfx.yxt.baidu.aip;

public enum ErrorCode {

	FACE_NUM_OUT("face_num_out", "图片人脸过多"),
	FACE_EXISTS("face_exists", "已有相似的图片，无须重复上传"),
	FACE_SIZE_MIN("face_size_min", "照片中的人脸太小，请用两手指在虚线框中挤压放大人脸"),
	HAS_GLASSES("has_glasses", "人脸图片不能带眼镜"),
	SDK100("SDK100", "图片大小超限"),
	SDK101("SDK101", "图片边长不符合要求"),
	SDK102("SDK102", "读取图片文件错误"),
	SDK108("SDK108", "连接超时或读取数据超时"),
	SDK109("SDK109", "不支持的图片格式"),
	CODE100("100", "无效参数"),
	CODE110("110", "Access Token失效"),
	CODE111("111", "无Access token过期"),
	CODE222001("222001", "必要参数未传入"),
	CODE222202("222202", "图片中没有人脸，请换张图片再试"),
	CODE222203("222203", "无法解析人脸，请检查图片质量"),
	CODE223113("223113", "人脸有被遮挡，请换张图片再试"),
	CODE223114("223114", "人脸模糊，请换张图片再试"),
	CODE223115("223115", "人脸光照不好，请换张图片再试"),
	CODE223116("223116", "人脸不完整，请换张图片再试");
	
	private String errorCode;
	
	private String errorMsg;
	
	private ErrorCode(String errorCode, String errorMsg) {
		this.errorCode = errorCode;
		this.errorMsg = errorMsg;
	}

	public String getErrorCode() {
		return errorCode;
	}

	public String getErrorMsg() {
		return errorMsg;
	}
	
	public static String getErrorDesc(String errorCode) {
		for(ErrorCode type : ErrorCode.values()) {
			if(type.getErrorCode().equals(errorCode)) {
				return type.getErrorMsg();
			}
		}
		return null;
	}
}

